home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 200 / text0000.txt < prev   
Encoding:
Text File  |  1996-08-06  |  1007 b   |  36 lines

  1. >>>>> Joe Buck <jbuck@Synopsys.COM> writes:
  2.  
  3. > Stroustrup proposes that operator. only forward to the resulting class
  4. > for a.m if the object itself doesn't have a member m.  I dislike that
  5. > approach; it is unnecessary since (&a)->m accesses it, and since
  6. > the class is going to present itself as a disguised reference object
  7. > in any case, only private code is going to mess around with the object's
  8. > own members.  In member functions, one would merely write "m".
  9.  
  10. I think a more natural way to achieve the delegation semantics proposed by
  11. Stroustrup would be to extend 'using' along these lines:
  12.  
  13. struct A {
  14.   void f  ();
  15. };
  16.  
  17. struct ARef {
  18.   A* a;
  19.   using *a;
  20. };
  21.  
  22. main ()
  23. {
  24.   ARef ar = { new A };
  25.   ar.f (); // (*(ar.a)).f();
  26. }
  27.  
  28. Of course, that's not likely to happen either.
  29.  
  30. Jason
  31.  
  32. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  33.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  34.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  35.  
  36.